/*
 *E3_3.cpp
 *Create by Administrator
 * 2017年1月20日
 * 下午2:32:27
 */
#include <iostream>
using std::string;
using std::cin;
using std::cout;
using std::endl;
int main() {
	string s1, s2;
	cin >> s1 >> s2;
	if (s1 < s2)
		cout << s2 << endl;
	else
		cout<< s1<<endl;

	if(s1.size()<s2.size())
		cout<<s2<<endl;
	else
		cout<<s1<<endl;

	return 0;
}
